package com.chen.deskclock.actionbarmenu;

import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;

import com.chen.deskclock.R;
import com.chen.sjn.MorningNews;

public class MorningNewsMenuItemController implements MenuItemController {

    public static final int REQUEST_MORNING_NEWS = 1;
    private static final int MORNING_NEWS_MENU_RES_ID = R.id.menu_item_morning_news;
    private final Activity mActivity;

    public MorningNewsMenuItemController(Activity activity) {
        mActivity = activity;

    }

    @Override
    public int getId() {
        return MORNING_NEWS_MENU_RES_ID;
    }

    @Override
    public void onCreateOptionsItem(Menu menu) {
        menu.add(Menu.NONE, MORNING_NEWS_MENU_RES_ID, Menu.NONE, R.string.menu_item_morning_news)
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);

    }

    @Override
    public void onPrepareOptionsItem(MenuItem item) {

    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        final Intent MorningNewsIntent = new Intent(mActivity, MorningNews.class);
        mActivity.startActivityForResult(MorningNewsIntent, REQUEST_MORNING_NEWS);
        return true;
    }
}
